// 导入request.js工具
import request from '@/utils/request.js'

// 获取所有医院信息
export const getAllHospitalsService = () => {
    return request.get('/admin/hospitals');
}

// 添加医院
export const addHospitalService = (hospital) => {
    return request.post('/admin/hospitals', hospital);
}

// 删除医院
export const deleteHospitalService = (hospitalId) => {
    return request.delete(`/admin/hospitals`, { params: { hospitalId } });
}
// 获取所有科室信息
export const getAllDepartmentsService = () => {
    return request.get('/admin/hospitals/departments');
}

// 添加科室
export const addDepartmentService = (department) => {
    return request.post('/admin/hospitals/departments', department);
}

// 删除科室
export const deleteDepartmentService = (departmentId) => {
    return request.delete(`/admin/hospitals/departments`, { params: { departmentId } });
}
// 获取所有门诊信息
export const getAllClinicsService = () => {
    return request.get('/admin/hospitals/clinics');
}
// 添加门诊
export const addClinicService = (clinic) => {
    return request.post('/admin/hospitals/clinics', clinic);
}

// 删除门诊
export const deleteClinicService = (clinicId) => {
    return request.delete(`/admin/hospitals/clinics`, { params: { clinicId } });
}

// 添加医生
export const addDoctorService = (doctor) => {
    return request.post('/admin/hospitals/doctors', doctor);
}

// 删除医生
export const deleteDoctorService = (doctorId) => {
    return request.delete(`/admin/hospitals/doctors`, { params: { doctorId } });
}

// 根据医院ID获取科室信息
export const getDepartmentsByHospitalIdService = (hospitalId) => {
    return request.get(`/admin/hospitals/departments`, { params: { hospitalId } });
}

// 根据科室ID获取诊所信息
export const getClinicsByDepartmentIdService = (departmentId) => {
    return request.get(`/admin/hospitals/clinics`, { params: { departmentId } });
}

// 根据诊所ID获取医生信息
export const getDoctorsByClinicIdService = (clinicId) => {
    return request.get(`/admin/hospitals/doctors`, { params: { clinicId } });
}
//更新医院信息
export const updateHospitalService = (hospital) => {
    return request.put('/admin/hospitals', hospital);
}
//更新科室信息
export const updateDepartmentService = (department) => {
    return request.put('/admin/hospitals/updateDepartments', department);
}
//更新诊所信息
export const updateClinicService = (clinic) => {
    return request.put('/admin/hospitals/updateClinics', clinic);
}


